<?php require_once(dirname(__FILE__)."/config/config.php"); ?>
<?php require 'info.php';?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>密码找回</title>
<link href="http://www.dianexia.com/css/public/forward.css" type="text/css" rel="stylesheet"></link>
<style type="text/css"></style>
</head>

<body screen_capture_injected="true">
<div id="background"></div>
<center>
<h2 style="margin-top:80px;padding:10px"><b>找回密码</b></h2>
<form method="post">
邮&nbsp;&nbsp;箱:<input name="email" type="text" size="20" /><br />
<input name="submit" type="submit" value="提交" size="20" />
</form>
</center>
<?php 
	   $root=SITE_ROOT;
       $email=$_POST['email'];
	   $sql="select * from zy_user where  mail = '".$email."'";
	   $result = mysql_query($sql);
	   $zy_user = mysql_fetch_array($result);
	   $address = SITE_ROOT;
	   if(isset($_POST['submit']))
	 {
	   if($zy_user)
	   {
	   		
			$mailcfg['server'] = 'smtp.exmail.qq.com'; 
			
			$mailcfg['port'] = '25'; 
			
			$mailcfg['auth'] = 1; 
			$mailcfg['from'] = 'service@dianexia.com '; 
			
			$mailcfg['auth_username'] = 'service@dianexia.com'; 
			
			$mailcfg['auth_password'] = 'dianyixia2012'; 
			$stmp=new stmp($mailcfg); 
			$mail=array('to'=>$email,'subject'=>'修改密码','content'=>'请点击链接倒修改密码页:'.$root.'/change_password.php?a='.base64_encode($zy_user["user_id"]).
			'&time='.base64_encode(date("YmdHis")));
		//	$mail=array('to'=>$email,'subject'=>'修改密码','content'=>'请点击链接倒修改密码页:'.'http://localhost:8080/dianexia/change_password.php?a='.$zy_user["user_id"]);
		 // print_r($mail); 
			if($stmp->send($mail)){
				echo "<script>alert('发送成功!')</script>";
				echo "<script>window.close()</script>"; 
		}else{
			echo "<script>alert('发送失败!')</script>"; 
		}
	   }else{
	   		echo "<script>alert('你输入的邮箱地址不对,请重新输入!')</script>";
	   }
	   
	   }

 ?>
</body>
</html>
